<?
  include("com/website_config.php");
  $pathurltrue=__FILE__;
  $pathurl=basename($pathurltrue,".php");
  	$PageSize = 12 ;             //每页显示记录数
	$StartRow = 0;             //指针在数据库的初始位置
						   //获取需要显示的页数，由用户提交
	$getpage=(int)$_GET['PageNo'];
	if(empty($getpage)){        //如果为空，则表示第1页
	if($StartRow == 0){
	$PageNo = $StartRow + 1;    //设定为1
	}
	}else{
	$PageNo = (int)$_GET['PageNo'];         //获得用户提交的页数
	$StartRow = ($PageNo - 1) * $PageSize;  //获得开始显示的记录编号
	}
	
	if($PageNo % $PageSize == 0){
	$CounterStart = $PageNo - ($PageSize - 1);
	}else{
	$CounterStart = $PageNo - ($PageNo % $PageSize) + 1;
	}
	//显示页码的最大值
	$CounterEnd = $CounterStart + ($PageSize - 1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>安全品质</title>
<link rel="shortcut icon" href="/favicon.ico"/>
<link href="css/css.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://www.ashlybus.com/js/jquery-1.9.1.min.js"></script>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?429d331d02551c5c42fbfb2982cfcf64"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>

<body>
<? include("top.php");?>

<div class="jiange"></div>
<div class="nowplace">当前位置：<span><a href="/">首页</a></span><span>&nbsp;>&nbsp;</span><span>安全品质</span></div>

<div class="jiange"></div>
<div class="innerbox">
     <div class="innerleft fl">
          <div class="innerleft_title">安全品质</div>
          <ul>
		  <?
				$sql="select * from ms_protype where pid=2";
				$onpage_cl = $db->query($sql);
				$rs=mysql_num_rows($onpage_cl);
				if($rs==""){
						echo"<center>".'暂时还没有信息!'."</center>";					
				}
				else
				{			
				while($array=mysql_fetch_array($onpage_cl))
				{
				$onepageid=(int)$_GET['typeid'];
				$nowID=(int)$array['type_id'];
			?>
              <li><a  <? if($onepageid==$nowID){?>class="now"<? }else{}?> href="anquan.php?typeid=<? echo $array["type_id"];?>"><? echo $array['type_name'];?></a></li>
			  <?
				}
			}
		   ?>

          </ul>
     </div>
     <div class="innerright fr">
     	  <div class="innertit">
          		<p class="p1 fl">安全品质</p>
                <div class="cl"></div>
          </div>
          <div class="inner_listbox">
               <ul>
			   <?				
					 $typeid_array=(int)$_GET['typeid'];
					 if($typeid==""){
						//$typeid=;
						$typeid_array="10,11,12,13";
					 }
					global $record;
					global $TRecord;
					
					$db = new DataAccess();
					$db->connect();
					
					$query = "select * from ms_product where pro_tid in ($typeid_array) order by pro_id desc";
					$query2 = "select * from ms_product where pro_tid in ($typeid_array) order by pro_id desc LIMIT $StartRow,$PageSize";
					
					$TRecord = $db->query($query);
					$record = $db->query($query2);
				
				$rs1=mysql_num_rows($TRecord);
				if($rs1==""){
						echo"<p align=center>".'暂时还没有信息!'."</p>";
				}
				else
				{
					//获取总记录数
					$RecordCount = mysql_num_rows($TRecord);
					//获取总页数
					$MaxPage = $RecordCount % $PageSize;
					if($RecordCount % $PageSize == 0){
						$MaxPage = $RecordCount / $PageSize;
					}
					else{
					}          
					$MaxPage = ceil($RecordCount / $PageSize);
					
					$i = 1;
					while($array=mysql_fetch_array($record))
						{
						  $bil = $i + ($PageNo-1)*$PageSize;	  
				?>
                   <li>
				   <?
		  //从相册中查询出一个图片
		  $pro_id=$array['pro_id'];
		  $photoSQL="select * from ms_product_photo where pro_id=$pro_id limit 1";
		  $rs=$db->query($photoSQL);
		  $photoArray=mysql_fetch_array($rs);
		  
		   $pro_pic=$photoArray["img_path"];
		   $proimgpath=str_replace("../../","","$pro_pic");//图片路径重置

		   if(!file_exists($proimgpath)){//图片不存在
			echo "<img src='images/nopic.jpg' border='0' width='220' height='158' />";							
		   }else{
		?>
                       <div class="carimg"><a href="anquan_details.php?typeid=<? echo $typeid;?>&detail_id=<? echo $array['pro_id']; ?>"><img src="<? echo $proimgpath; ?>" /></a></div>
					   <? 
		 }
		?>
                       <div class="cartext"><a href="#"><? echo $array["pro_title"]; ?></a></div>
                   </li>
				   <? 
					  $i++;
					}
?>
                   
               </ul>
               <div class="cl"></div>
               <div class="page">
			   <? 
	if($MaxPage>1){
	include ('com/page_pro.php');
	}else{
	}
	?></div>
	<? 
		}
	?>
	
          </div>
     </div>
     <div class="cl"></div>
</div>

<? include("foot.php");?>
</body>
</html>
